package cn.texous.demo.dos.controller;

import cn.texous.util.commons.constant.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * This file allows the client apps to find out more about
 * the users that authenticate with the server.
 *
 * @author leven
 * @since 2019/7/13 18:49
 */
@RestController
public class UserController {

    @GetMapping("/user/me")
    public Principal user(Principal principal) {
        return principal;
    }

    @PostMapping("/user/check/auth")
    public Result checkUserAuth(Principal principal, String path) {
        System.out.println(path);
        return Result.ok(path);
    }

}
